home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
MNetsrc.hqx
/
Mac TCP_IP Source v.33
/
global.h
< prev
next >
Wrap
Text File
|
1989-02-01
|
3KB
|
102 lines
/* Global definitions used by every source file.
* Some may be compiler dependent.
*/
/*
* the MAC and AMIGA preprocessors do not understand the defined
* directive.
*/
#define MAC 1
#ifdef MAC
#define defined(x) x
#endif
#ifdef AMIGA
#define defined(x) x
#endif
#ifdef MAC
#define PATH_DELIM ':' /* to tell the pathname delimiter */
#else
#define PATH_DELIM '/' /* to tell the pathname delimiter */
#endif
/* Indexes into binmode in files.c; hook for compilers that have special
* open modes for binary files
*/
#define READ_BINARY 0
#define WRITE_BINARY 1
extern char *binmode[];
/* These two lines assume that your compiler's longs are 32 bits and
* shorts are 16 bits. It is already assumed that chars are 8 bits,
* but it doesn't matter if they're signed or unsigned.
*/
typedef long int32; /* 32-bit signed integer */
typedef unsigned short int16; /* 16-bit unsigned integer */
#define uchar(x) ((unsigned char)(x))
#define MAXINT16 65535 /* Largest 16-bit integer */
/* Since not all compilers support structure assignment, the ASSIGN()
* macro is used. This controls how it's actually implemented.
*/
#ifdef NOSTRUCTASSIGN /* Version for old compilers that don't support it */
#define ASSIGN(a,b) memcpy((char *)&(a),(char *)&(b),sizeof(b));
#else /* Version for compilers that do */
#define ASSIGN(a,b) ((a) = (b))
#endif
/* Define null object pointer in case stdio.h isn't included */
#ifndef NULL
/* General purpose NULL pointer */
#define NULL (void *)0
#endif
#define NULLCHAR (char *)0 /* Null character pointer */
#define NULLFP (int (*)())0 /* Null pointer to function returning int */
#define NULLVFP (void (*)())0 /* Null pointer to function returning void */
#define NULLFILE (FILE *)0 /* Null file pointer */
/* General purpose function macros */
#define min(x,y) ((x)<(y)?(x):(y)) /* Lesser of two args */
#define max(x,y) ((x)>(y)?(x):(y)) /* Greater of two args */
#ifdef MPU8080 /* Assembler routines are available */
int16 hinibble(),lonibble(),hibyte(),lobyte(),hiword(),loword();
#else
/* Extract a short from a long */
#define hiword(x) ((int16)((x) >> 16))
#define loword(x) ((int16)(x))
/* Extract a byte from a short */
#define hibyte(x) (((x) >> 8) & 0xff)
#define lobyte(x) ((x) & 0xff)
/* Extract nibbles from a byte */
#define hinibble(x) (((x) >> 4) & 0xf)
#define lonibble(x) ((x) & 0xf)
#endif
#if (defined(SYS5) || defined(MAC))
#define rindex strrchr
#define index strchr
#endif
#if defined(MAC)
#define memcmp strncmp
#define memcpy(x,y,n) movmem((y),(x),(n))
#define memset(x,v,n) setmem((x),(n),(v))
#endif
/* Heavily used functions from the standard library */
char *index(),*rindex(),*malloc(),*calloc(),*ctime(),*tmpnam();
long atol(),htol();
#ifndef MAC
/* Hardware I/O functions that can be replaced with macros in some compilers */
unsigned char inportb();
unsigned int inportw();
#endif